package com.zhangxu.microservice.system.web.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import lombok.Data;

@Data
public class PageReq {

    /**
     * 每页最大大小
     */
    public static final int MAX_PAGE_SIZE = 1000;

    /**
     * 每页默认大小
     */
    public static final int DEFAULT_PAGE_SIZE = 10;

    /**
     * 默认页码
     */
    public static final int DEFAULT_PAGE_NUM = 1;

    @Min(value = DEFAULT_PAGE_NUM, message = "分页参数不正确")
    @Schema(description = "页码", defaultValue = "1", example = "1")
    private Integer pageNum = DEFAULT_PAGE_NUM;

    @Min(value = DEFAULT_PAGE_NUM, message = "分页参数不正确")
    @Max(value = MAX_PAGE_SIZE, message = "分页参数不正确")
    @Schema(description = "每页大小", defaultValue = "10", example = "10")
    private Integer pageSize = DEFAULT_PAGE_SIZE;
}
